package cn.xinfei.xdecision.common.model.common;

import com.github.pagehelper.PageInfo;
import lombok.Data;


@Data
public class VarPageResult<T, M> {

    private T klist;

    private PageInfo<M> pageInfo;

    public static <T, M> ResponseEntityDto<VarPageResult<T, M>> success(T klist, PageInfo<M> pageInfo) {
        ResponseEntityDto<VarPageResult<T, M>> responseEntityDto = new ResponseEntityDto<>();
        VarPageResult<T, M> pageResult = new VarPageResult<>();
        pageResult.setKlist(klist);
        pageInfo.setList(null);
        pageResult.setPageInfo(pageInfo);
        responseEntityDto.setStatus(ResponseEntityBuilder.RESPONSE_OK);
        responseEntityDto.setData(pageResult);
        return responseEntityDto;
    }
}
